home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 4 / Gold Medal Software - Volume 4 (Gold Medal) (1994).iso / os2 / ka2_01.arj / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1994-07-17  |  2KB  |  79 lines

  1. /* REXX - Installation */
  2. parse arg path
  3. Signal on Halt
  4. name = 'KA2'
  5. /* files.0 = 7 */
  6. files.0 = 8
  7.  
  8. files.1 = 'Kitchen.exe'
  9. files.2 = 'kitchen.hlp'
  10. files.3 = 'readme.1st'
  11. files.4 = 'register.frm'
  12. files.5 = 'problem.rpt'
  13. files.6 = 'Sample.ka'
  14. files.7 = 'kitchen.msg'
  15. files.8 = 'beta.txt'
  16. exe = 1
  17.  
  18. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  19. call SysLoadFuncs
  20.  
  21. if path = '' then do
  22.   ret = SysIni('SYSTEM', 'FolderWorkareaRunningObjects', 'ALL:', 'Desktop')
  23.   if ret <> '' | Desktop.0 <> 1 then do                                    
  24.     say 'Error locating Desktop, C:\' || name || ' will be used as a default'
  25.     path = 'C:\' || name
  26.   end
  27.   else path = left(Desktop.1, 2) || '\' || name
  28. end
  29.  
  30. r = 0
  31. p = ''
  32. do until p = ''
  33. say path
  34.   if SysFileTree(path, 'dir.', 'DO') then do
  35.     say '*** Error ***'
  36.     r = 99
  37.     call halt
  38.   end
  39.   if dir.0 > 0 then
  40.     msg = 'EXISTS.'
  41.   else msg = 'will be CREATED.'
  42.   say name 'will be installed in' translate(path) || '. The directory' msg
  43.   say 'Press <Enter> to accept, <Ctrl-C><Enter> to cancel or type a new directory path'
  44.   p = strip(linein())
  45.   if p <> '' then path = p
  46. end
  47.  
  48. path = strip(path, 'T', '\')
  49. if dir.0 = 0 then do
  50.   '@md 1>nul 2>nul' path
  51.   if rc <> 0 then do
  52.     say '*** ERROR *** Could not create directory' path
  53.     r = 99
  54.     call halt
  55.   end
  56. end
  57.  
  58. if directory() <> path then
  59.   do i = 1 to files.0
  60.     '@copy' files.i path
  61.   end
  62.  
  63. setup = 'EXENAME=' || path || '\' || files.exe || ';STARTUPDIR=' || path
  64. if SysCreateObject('WPProgram', name, '<WP_DESKTOP>', setup, 'F') then
  65.   say name 'has been created on your DESKTOP.'
  66. else do
  67.  say 'The program object' name 'could not be created, possible duplicate'
  68.  r = 99
  69.  call halt
  70. end
  71.  
  72. if r = 0 then say 'Install completed'
  73. '@pause'
  74. return r
  75. halt:
  76. say 'Install cancelled'
  77. '@pause'
  78.  
  79.